local shejian = fk.CreateSkill{
  name = "doublez__shejian",
  tags = {
    Skill.Compulsory
  }
}

Fk:loadTranslationTable{
  ["doublez__shejian"] = "舌剑",
  [":doublez__shejian"] = "锁定技，一名其他角色回复体力后，你与其各弃置一张牌，不能执行的改为由对方执行，再不能执行则你先摸四张牌。",

  ["$doublez__shejian1"] = "伤人的，可不止刀剑！",
  ["$doublez__shejian2"] = "死公！云等道？",
}

shejian:addEffect(fk.HpRecover, {
  can_trigger = function (self, event, target, player, data)
    return player ~= target and player:hasSkill(shejian.name)
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local discards_p = table.filter(player:getCardIds("he"), function (element)
      return not player:prohibitDiscard(element)
    end)
    local discards_t = table.filter(target:getCardIds("he"), function (element)
      return not target:prohibitDiscard(element)
    end)
    if #discards_p > 0 and #discards_t > 0 then
      room:askToDiscard(player, {
        min_num = 1,
        max_num = 1,
        cancelable = false,
        skill_name = shejian.name,
        include_equip = true,
      })
      room:askToDiscard(target, {
        min_num = 1,
        max_num = 1,
        cancelable = false,
        skill_name = shejian.name,
        include_equip = true,
      })
    elseif #discards_p >= 2 then
      room:askToDiscard(player, {
        min_num = 2,
        max_num = 2,
        cancelable = false,
        skill_name = shejian.name,
        include_equip = true,
      })
    elseif #discards_t >= 2 then
      room:askToDiscard(target, {
        min_num = 2,
        max_num = 2,
        cancelable = false,
        skill_name = shejian.name,
        include_equip = true,
      })
    else
      room:drawCards(player, 4)
      discards_p = table.filter(player:getCardIds("he"), function (element)
        return not player:prohibitDiscard(element)
      end)
      local num = math.min(#discards_p, 2)
      room:askToDiscard(player, {
        min_num = num,
        max_num = num,
        cancelable = false,
        skill_name = shejian.name,
        include_equip = true,
      })
    end
  end
})

return shejian